//
// Description: 1877. 数组中最大数对和的最小值
// Created by Loading on 2021/7/20.
//

#include <bits/stdc++.h>

using namespace std;

int minPairSum(vector<int> &nums) {
    sort(nums.begin(), nums.end());
    int res = 0;
    for (int i = 0, j = (int) nums.size() - 1; i < j; ++i, --j) {
        res = max(res, nums[i] + nums[j]);
    }

    return res;
}

int main() {
    vector<int> nums = {3, 5, 4, 2, 4, 6};
    cout << minPairSum(nums) << endl;
}